<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <button @click="handleClick(1,'egrg',{name:'我的'},$event)">按钮</button>
        <div style="width: 100px; height: 100px; background-color: coral;" @mousemove="handleMove" id="shitou"></div>
        <input type="text" @input="handleInput">
        <hr />
        <p>
            {{num}}
        </p>
        <button @click="handleClickAdd">增加</button>
        <form>
            用户名:<input type="text">
            <button type="submit" @click.prevent.stop="login">登录</button>
        </form>
        <hr>
        <input type="text" @keyup="handleKeyUp">
        <hr>
        <input type="text" @keyup.13="handleKeyUp">
        <input type="text" @keyup.enter="handleKeyUp">
    </div>
    <script src="./js/vue.js"></script>
    <script>
        //绑定事件指定
        const vm = new Vue({
            data: {
                num: 0
            },
            //函数数据定义在 methods中
            methods: {
                handleClick(...arguments) {
                    console.log("dnf50级了", arguments);
                },
                handleMove() {
                    console.log("忙啊", arguments);
                },
                handleInput() {
                    console.log("没时间玩了", arguments);
                },
                handleClickAdd() {
                    console.log(this);
                    this.num++;
                },
                login(a) {
                    /*  a.preventDefault(); */
                    console.log("登录中");
                },
                handleKeyUp(e) {
                    if (e.keyCode === 13) {
                        console.log("enter");
                    }
                }
            }
        })
        vm.$mount("#app");
    </script>
</body>

</html>